﻿package mortal.game.view.shopMall.view
{
    import Message.DB.Tables.*;
    import com.mui.controls.*;
    import extend.language.*;
    import fl.data.*;
    import flash.events.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class ShopGroupPanel extends ShopCopyPanel
    {
        private var _shopList:Array;
        private var _tabBar:GTileList;

        public function ShopGroupPanel()
        {
            this._shopList = new Array();
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.pushUIToDisposeVec(UIFactory.bg(0, 0, 740, 42, this, ImagesConst.ShopGroupTabBg));
            this._tabBar = UIFactory.tileList(17, 0, 740, 50, this);
            this._tabBar.columnWidth = 100;
            this._tabBar.rowHeight = 50;
            this._tabBar.horizontalGap = 1;
            this._tabBar.verticalGap = 4;
            this._tabBar.setStyle("cellRenderer", ShopGroupTabCellRender);
            this.addChild(this._tabBar);
            this._tabBar.configEventListener(Event.CHANGE, this.onTabChangeHandler);
            _goodsList.y = 45;
            _pageSelecter.move(267 + 59, 390);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._tabBar.dispose(param1);
            this._tabBar = null;
            this._shopList = [];
            super.disposeImpl(param1);
            return;
        }// end function

        public function getItemsByTab2(param1:int = -1, param2:int = 0) : void
        {
            if (this._tabBar.dataProvider.length < (param2 + 1))
            {
                param2 = 0;
                MsgManager.showRollTipsMsg(Language.getString(35568), MsgRollTipsType.msgRollTips3);
            }
            this._tabBar.selectedIndex = param2;
            var _loc_3:* = this._tabBar.dataProvider.getItemAt(this._tabBar.selectedIndex).info;
            this.getItemsByTabAndPage(_loc_3.code, 1, 0, param1);
            return;
        }// end function

        private function onTabChangeHandler(event:Event = null) : void
        {
            var _loc_2:* = this._tabBar.dataProvider.getItemAt(this._tabBar.selectedIndex).info;
            this.getItemsByTabAndPage(_loc_2.code, 1, 0);
            return;
        }// end function

        private function getShopDataProvider(param1:Array) : DataProvider
        {
            var _loc_3:TShop = null;
            var _loc_2:* = new DataProvider();
            for each (_loc_3 in param1)
            {
                
                _loc_2.addItem({info:_loc_3});
            }
            return _loc_2;
        }// end function

        public function setShopList(param1:Array) : void
        {
            this._shopList = param1;
            this._tabBar.dataProvider = this.getShopDataProvider(this._shopList);
            this._tabBar.selectedIndex = this._tabBar.dataProvider.length - 1;
            this.onTabChangeHandler();
            return;
        }// end function

    }
}
